import 'package:flutter/src/painting/text_span.dart';
import 'package:myturngame/Theme.dart';
import 'package:myturngame/bean/function/abstract_function.dart';
import 'package:myturngame/bean/role.dart';

///常规装备属性
class NormalEquipFunction extends AbstractEquipFunction {
  //属性类型
  static String hp = "气血";
  static String mp = "法力";

  static String power = "力量";
  static String magic = "魔力";
  static String patience = "耐力";
  static String agility = "敏捷";
  static String health = "体力";
  static String criticalRate = "暴击率";

  static String attack = "攻击力";
  static String magicAttack = "法伤";
  static String defend = "防御";
  static String speed = "速度";

  int type;
  int value;

  NormalEquipFunction(this.type, this.value);

  String name() => [
        "无效属性",
        "无效属性",
        "无效属性",
        "无效属性",
        "无效属性",
        "无效属性",
        //属性
        "气血",
        "法力",
        "攻击力",
        "法伤",
        "防御",
        //属性点
        "速度",
        "力量",
        "魔力",
        "耐力",
        "敏捷",
        "体力",
        //暴击
        "暴击率",
        "暴击伤害",
      ].elementAt(type);

  @override
  String toString() {
    return "${name()} ${value > 0 ? "+" : ""}$value";
  }

  @override
  List<TextSpan> description() {
    var end = "";
    if(type == AttributeSet.criticalRate || type == AttributeSet.criticalDamage){
      end = "%";
    }
    return [
      TextSpan(text: "${name()} ", style: textStyleFunction),
      TextSpan(
          text: "${value > 0 ? "+" : ""}$value$end",style: textStyleFunction),
    ];
  }
}
